package com.kingsoft.dc.khaos.module.spark.preprocess.specific.quality

/**
  * 数据统计类，用于存放可提炼的重复代码
  *
  */
class DataStatistics extends Serializable{
  def compareValue(strings: Array[String],fieldValue: Int): Int ={//gzzId <= 100
    var record: Int = 0
    strings(2) match {
      case ">"   => {
        if (fieldValue <= strings(3).toInt) record += 1
      }
      case ">=" => {
        if (fieldValue < strings(3).toInt) record += 1
      }
      case "<" => {
        if (fieldValue >= strings(3).toInt) record += 1
      }
      case "<=" => {
        if (fieldValue > strings(3).toInt) record += 1
      }
      case "=" => {
        if (fieldValue != strings(3).toInt) record += 1
      }
      case "!=" => {
        if (fieldValue == strings(3).toInt) record += 1
      }
    }
    record
  }
}
